package com.javaspeak.designpatterns.go4.structural.adapter;



/**
 * This class is the adapter. We are providing a wrapper around Shape so that
 * when we call draw() internally we are calling shape.drawSquare()
 *
 * @author John Dickerson
 *
 */
public class ShapeAdapter implements Square {

    private Shape shape;

    /**
     * Constructor that wraps the Shape
     *
     * @param shape
     */
    public ShapeAdapter( Shape shape ){

        this.shape = shape;
    }

    /* (non-Javadoc)
     * @see com.javaspeak.designpatterns.go4.structural.adapter.Square#draw()
     */
    @Override
    public void draw() {

        // The draw() method belongs to the Application API. It wraps the
        // third party drawSquare() method.

        shape.drawSquare();
    }
}
